package com.young.shop.pojo.vo;

/**
 * 返回数据封装
 * @param <T>
 */


public class Parmpacking<T> {
    private int status;
    private String message;
    private T date;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getDate() {
        return date;
    }

    public void setDate(T date) {
        this.date = date;
    }

    public static <T> Parmpacking<T> success(T date){
        Parmpacking<T> parmpacking = new Parmpacking();
        parmpacking.setDate(date);
        parmpacking.setMessage(StatusCode.SUCCESS.getMsg());
        parmpacking.setStatus(StatusCode.SUCCESS.getStatus());
        return parmpacking;
    }



    public static <T> Parmpacking<T> error(){
   Parmpacking<T> parmpacking = new Parmpacking<>();
        parmpacking.setMessage(StatusCode.SYS_ERROR.getMsg());
        parmpacking.setStatus(StatusCode.SYS_ERROR.getStatus());
        return parmpacking;
    }

    public Parmpacking(int status, String message, T date) {
        this.status = status;
        this.message = message;
        this.date = date;
    }

    public Parmpacking() {
    }



    @Override
    public String toString() {
        return "Parmpacking{" +
                "status=" + status +
                ", message='" + message + '\'' +
                ", date=" + date +
                '}';
    }
}